# Example
# Assume that myData is a data.frame
# dateLow and dateHigh are a date range (character)

# connection to datapath
g <- new("glade", server="datapath", user="alin");

company <- read(g, quote(company));
cF <- company[ bquote(company.date>=.(dateLow) && company.date<=.(dateHigh) ) ];
ccF  = as.glade(g, myData );

# filter companies using a join
rComp <- join( cF, ~company.cid, ccF, ~cid);

# group on industry
rGroup <- groupby( rComp, groupatt = ~ company.industry + company.year
                  aggregate = ~SumGLA + AverageGLA,
                  result = ~ind+year+sum+average);

# order by
ord <- orderby( rGroup, order=~ -ind : year, extra=~sum, limit=10 );

resTable <- toDataFrame( ord, ~ ind : year : sum , extra=~(ind+year+sum));
